import cv2;
from cvzone.HandTrackingModule import HandDetector;

# 获取摄像头
cap = cv2.VideoCapture(0);
cap.set(3,1280);
cap.set(4,720);

# 手部侦测模块初始化
detector = HandDetector();

while True:
    ret , img = cap.read();
    if ret:
        img = detector.findHands(img);
        lmList, bboxInfo = detector.findPosition(img);
        # 显示每一帧
        cv2.imshow("Frame", img);

    # q键退出
    if cv2.waitKey(1) == ord('q'):
        break;
